//
//  EventHandlerTest.m
//  eventbus-niblvl50
//
//  Created by Niblit on 2010-03-10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "EventHandlerTest.h"
#import "EventHandler.h"


@interface TestEvent : NSObject
@end

@implementation TestEvent
@end


@implementation EventHandlerTest

-(void) TestEventHandler
{
	EventHandler* instance = [EventHandler getInstance];
	[instance AddListener:self withSelector:@selector(ReceiveTestEvent) forEvent:[TestEvent class]];
	
	TestEvent* event = [[TestEvent alloc] init];
	[instance SendEvent:event];
	[event release];
	
	BOOL falseResult = [instance RemoveListener:self forEvent:[NSString class]];
	STAssertFalse(falseResult, @"hmm");
	
	BOOL trueResult = [instance RemoveListener:self forEvent:[TestEvent class]];
	STAssertTrue(trueResult, @"should be true");
}

-(void) ReceiveTestEvent:(TestEvent*)event
{
	STAssertNotNil(event, @"hmm");
}

@end
